<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->

<!--[if !IE]><!--> <html lang="zh-CN"> <!--<![endif]-->

<!-- BEGIN HEAD -->

<head>

	<meta charset="utf-8" />

	<title>技术员管理</title>

	<meta content="width=device-width, initial-scale=1.0" name="viewport" />

	<meta content="" name="description" />

	<meta content="" name="author" />

	<!-- BEGIN GLOBAL MANDATORY STYLES -->

	<link href="__PUBLIC__/media/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>

	<link href="__PUBLIC__/media/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>

	<link href="__PUBLIC__/media/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>

	<link href="__PUBLIC__/media/css/style-metro.css" rel="stylesheet" type="text/css"/>

	<link href="__PUBLIC__/media/css/style.css" rel="stylesheet" type="text/css"/>

	<link href="__PUBLIC__/media/css/style-responsive.css" rel="stylesheet" type="text/css"/>

	<link href="__PUBLIC__/media/css/default.css" rel="stylesheet" type="text/css" id="style_color"/>

	<link href="__PUBLIC__/media/css/uniform.default.css" rel="stylesheet" type="text/css"/>

	<!-- END GLOBAL MANDATORY STYLES -->

	<!-- BEGIN PAGE LEVEL STYLES -->

	<link rel="stylesheet" type="text/css" href="__PUBLIC__/media/css/select2_metro.css" />

	<link rel="stylesheet" href="__PUBLIC__/media/css/DT_bootstrap.css" />

	<!-- END PAGE LEVEL STYLES -->

	<link rel="shortcut icon" href="__PUBLIC__/media/image/favicon.ico" />

</head>

<!-- END HEAD -->

<!-- BEGIN BODY -->

<body class="page-header-fixed">
<input type="hidden" id="token" value="@#$_GET['token']#@">
	<!-- BEGIN HEADER -->

	<div class="header navbar navbar-inverse navbar-fixed-top">
		<!-- BEGIN TOP NAVIGATION BAR -->
		<div class="navbar-inner">
			<div class="container-fluid">
				<!-- BEGIN LOGO -->
				<a class="brand" href="__APP__/Home/AdminPage/index?token=@#$_GET['token']#@">
				<img src="__PUBLIC__/media/image/logo.png" alt="logo" />
				</a>
				<!-- END LOGO -->
				<!-- BEGIN RESPONSIVE MENU TOGGLER -->
				<a href="javascript:;" class="btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse">
				<img src="__PUBLIC__/media/image/menu-toggler.png" alt="" />
				</a>          
				<!-- END RESPONSIVE MENU TOGGLER -->            
				<!-- BEGIN TOP NAVIGATION MENU -->              
				<ul class="nav pull-right">
					<!-- BEGIN USER LOGIN DROPDOWN -->
							<li class="dropdown user">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown">
						<img alt="" src="__PUBLIC__/media/image/avatar1_small.jpg" />
						<span class="username">账户</span>
						<i class="icon-angle-down"></i>
						</a>
						<ul class="dropdown-menu">
							
							<li><a href="__APP__/Home/AccountPage/logout"><i class="icon-key"></i> 退出</a></li>
						</ul>
					</li>
					<!-- END USER LOGIN DROPDOWN -->
				</ul>
				<!-- END TOP NAVIGATION MENU --> 
			</div>
		</div>
		<!-- END TOP NAVIGATION BAR -->
	</div>

	<!-- END HEADER -->

	<!-- BEGIN CONTAINER -->

	<div class="page-container row-fluid">

		<!-- BEGIN SIDEBAR -->
<div class="page-sidebar nav-collapse collapse">
			<!-- BEGIN SIDEBAR MENU -->        
			<ul class="page-sidebar-menu">
				<li class=" start ">
					<a href="__APP__/Home/AdminPage/index?token=@#$_GET['token']#@">
					<i class="icon-home"></i> 
					<span class="title">HOME</span>
					</a>
				</li>
				<li class="">
					<a href="__APP__/Home/AdminPage/user?token=@#$_GET['token']#@">
					<i class="icon-cogs"></i> 
					<span class="title">用户管理</span>
					</a>
				</li>
				<li class="active">
					<a href="__APP__/Home/AdminPage/staff?token=@#$_GET['token']#@">
					<i class="icon-table"></i> 
					<span class="title">技术员管理</span>
					</a>
				</li>
				<li class="">
					<a href="__APP__/Home/AdminPage/order?token=@#$_GET['token']#@">
					<i class="icon-bookmark-empty"></i> 
					<span class="title">订单管理</span>
					</a>
				</li>
				<li class="last">
					<a href="__APP__/Home/AdminPage/set?token=@#$_GET['token']#@">
					<i class="icon-user"></i> 
					<span class="title">设置</span>
					</a>
				</li>
			</ul>
			<!-- END SIDEBAR MENU -->
		</div>

		<!-- END SIDEBAR -->

		<!-- BEGIN PAGE -->

		<div class="page-content">

			<!-- BEGIN PAGE CONTAINER-->        

			<div class="container-fluid">

				<!-- BEGIN PAGE HEADER-->

				<div class="row-fluid">

					<div class="span12">

						<!-- BEGIN PAGE TITLE & BREADCRUMB-->

						<h3 class="page-title">

							技术员管理 
						</h3>

						<ul class="breadcrumb">

							<li>

								<i class="icon-home"></i>

								<a href="__APP__/Home/AdminPage/index?token=@#$_GET['token']#@">Home</a>

								<i class="icon-angle-right"></i>

							</li>

							<li>

								<a href="#">技术员管理</a>

								<i class="icon-angle-right"></i>

							</li>

						</ul>

						<!-- END PAGE TITLE & BREADCRUMB-->

					</div>

				</div>

				<!-- END PAGE HEADER-->

				<!-- BEGIN PAGE CONTENT-->

				<div class="row-fluid">

					<div class="span9">

						<!-- BEGIN EXAMPLE TABLE PORTLET-->

						<div class="portlet box blue">

							<div class="portlet-title">

								<div class="caption"><i class="icon-edit"></i>技术员管理</div>

								<div class="tools">

									<a href="javascript:;" class="reload"></a>

								</div>

							</div>

							<div class="portlet-body">
<p align="center" id="errormsg" class="alert alert-success" style="display:none; font-size:16px; font-weight:bold;"></p>
								<table class="table table-striped table-hover table-bordered" id="sample_editable_1">

									<thead>

										<tr>

											<th>姓名</th>
					
											<th>手机号码</th>

											<th>Email</th>

											<th>当前活动订单</th>											

											<th>每日接单限制</th>
											
											<th>当前状态</th>
										</tr>

									</thead>

									<tbody>
             <foreach name="staff_list" item="vo">
										<tr>

											<td><a href="__APP__/Home/AdminPage/order/staff_id/@#$vo.staff_id#@?token=@#$_GET['token']#@">@#$vo.name#@</a></td>

											<td>@#$vo.phone#@</td>

											<td>@#$vo.email#@</td>

											<td><a href="__APP__/Home/AdminPage/order/status/doing_staff/staff_id/@#$vo.staff_id#@?token=@#$_GET['token']#@">@#$vo.doing_count#@</a></td>

											<td class="staffmax" staffid="@#$vo.staff_id#@">@#$vo.max#@</td>

											<td>
											
													<select staffid="@#$vo.staff_id#@" cs="staff_group" class="m-wrap small" >
													<option <php>if($vo['']==0){echo selected;}</php> value="0">可用</option>
													<option <php>if($vo['status']==1){echo selected;}</php> value="1">不可用</option>
								
												</select>
											</td>

										</tr>

									</foreach>	

									</tbody>

								</table>
  @#$page#@
							</div>

						</div>

						<!-- END EXAMPLE TABLE PORTLET-->

					</div>

					<div class="span3">

						<div class="portlet box grey">

							<div class="portlet-title">

								<div class="caption"><i class="icon-comments"></i></div>

							</div>

							<div class="portlet-body fuelux">

								<label>
								<form method="get" action="__APP__/Home/AdminPage/staff_search/token/@#$_GET['token']#@">
									<input type="text" name="key" class="m-wrap small">
									<button type="submit" class="btn grey"><i class="icon-search"></i></button>
									</form>
								</label>

								<table class="table table-striped table-bordered table-hover table-full-width dataTable" align="center">
										<tr><td><a href="__APP__/Home/AdminPage/staff?token=@#$_GET['token']#@">所有技术员</a></td></tr>
									<tr><td><a href="__APP__/Home/AdminPage/staff/status/yes?token=@#$_GET['token']#@">可用技术员</a></td></tr>
									<tr><td><a href="__APP__/Home/AdminPage/staff/status/no?token=@#$_GET['token']#@">不可用技术员</a></td></tr>
								</table>

							</div>

						</div>
					</div>

				</div>

				<!-- END PAGE CONTENT -->

			</div>

			<!-- END PAGE CONTAINER-->

		</div>

		<!-- END PAGE -->

	</div>

	<!-- END CONTAINER -->

	<!-- BEGIN FOOTER -->

	<div class="footer">

		<div class="footer-inner">

		</div>

		<div class="footer-tools">

			<span class="go-top">

			<i class="icon-angle-up"></i>

			</span>

		</div>

	</div>

	<!-- END FOOTER -->

	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->

	<!-- BEGIN CORE PLUGINS -->

	<script src="__PUBLIC__/media/js/jquery-1.10.1.min.js" type="text/javascript"></script>

	<script src="__PUBLIC__/media/js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>

	<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

	<script src="__PUBLIC__/media/js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>      

	<script src="__PUBLIC__/media/js/bootstrap.min.js" type="text/javascript"></script>

	<script src="__PUBLIC__/media/js/app.js"></script>


	<script>

		jQuery(document).ready(function() {       

		   App.init();

		});

	</script>

<script type="text/javascript">
$(document).ready(function(){
	var token=$("#token").val();
	var numTd = $(".staffmax"); 
	numTd.click(function(){ 
		var staff_id=$(this).attr("staffid");
	//创建文本框对象 
	var inputobj = $("<input type='text' name='max'>"); 
	//获取当前点击的单元格对象 
	var tdobj = $(this); 
	//获取单元格中的文本 
	var text = tdobj.html(); 
	//如果当前单元格中有文本框，就直接跳出方法 
	if(tdobj.children("input").length>0){ 
	return false; 
	} 
	//清空单元格的文本 
	tdobj.html(""); 
	inputobj.css("border","0") 
	.css("font-size",tdobj.css("font-size")) 
	.css("font-family",tdobj.css("font-family")) 
	.css("background-color",tdobj.css("background-color")) 
	.css("color","#C75F3E") 
	.width(tdobj.width()) 
	.val(text) 
	.appendTo(tdobj); 
	inputobj.get(0).select(); 
	//阻止文本框的点击事件 
	inputobj.click(function(){ 
	return false; 
	}); 
	//处理文本框上回车和esc按键的操作 
	inputobj.keyup(function(event){ 
	var keycode = event.which; 
	//处理回车的情况 
	if(keycode==13){ 
	//获取当前文本框的内容 
		var inputtext = $(this).val(); 
		if( inputtext==""){alert("内容不能为空！");}
		else{
			
			
			$.post("__APP__/Home/Admin/staff_max_change?token="+token,{staff_id:staff_id,max:inputtext},function(data){
				if(data.status==1){
						$("p#errormsg").html("修改成功!").show(500).delay(2000).hide(500); 

					tdobj.html(inputtext); //将td的内容修改成文本框中的内容 
				
	   				}else{
	   					alert("修改失败");
	   				}
			});
		}
	} 
	//处理esc的情况 
	if(keycode == 27){ 
	//将td中的内容还原成text 
	tdobj.html(text); 
	} 
	}); 
	}); 


	$("[cs='staff_group']").change(function(){		
		var new_value=$(this).find("option:selected").val();
		var staff_id=$(this).attr("staffid");
	    if(new_value==1){

	    	$.post("__APP__/Home/Admin/staff_status_change?token="+token,{staff_id:staff_id,status:new_value},function(data){
   				if(data.status==1){
   						$("p#errormsg").html("修改成功!").show(500).delay(2000).hide(500); 

					$(this).find("option[value="+new_value+"]").attr("selected",true);

   				}else{
   		  			 alert(data.info);
   		  				$("[staffid="+staff_id+"]").find("option:first").attr("selected",true); 
   					}
   			});
	    }
	    if(new_value==0){
	    	$.post("__APP__/Home/Admin/staff_status_change?token="+token,{staff_id:staff_id,status:new_value},function(data){
   				if(data.status==1){
   			$("p#errormsg").html("修改成功!").show(500).delay(2000).hide(500); 

					$(this).find("option[value="+new_value+"]").attr("selected",true);

   				}else{
   		  			 alert(data.info);
   		  			 	$("[staffid="+staff_id+"]").find("option:first").attr("selected",true); 
   					}
   			});
	    }
    });
}); 
</script>
</body>

<!-- END BODY -->

</html>